export REMOTE_PASS=123456
export REMOTE_PORT=22
export REMOTE_USER=root

for REMOTE_HOST in 192.168.0.16{1..8};do
 REMOTE_CMD="echo ${REMOTE_HOST} is successfully!"
 #添加⽬标远程主机的公钥
 ssh-keyscan -p "${REMOTE_PORT}" "${REMOTE_HOST}" >> ~/.ssh/known_hosts
 #通过sshpass配置免秘钥登录、并创建python3软连接
 sshpass -p "${REMOTE_PASS}" ssh-copy-id "${REMOTE_USER}@${REMOTE_HOST}"
 ssh ${REMOTE_HOST} ln -sv /usr/bin/python3 /usr/bin/python
 echo ${REMOTE_HOST} 免秘钥配置完成!
done
